package monocle.openinnitterpublic

import android.content.Context
import androidx.appcompat.app.AppCompatActivity

abstract class PreferenceActivity : AppCompatActivity() {

    private val preferences get() = getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)

    operator fun get(service: Service): String =
        preferences.getString(service.preferenceKey, service.defaultValue)!!

    operator fun set(service: Service, value: String) =
        preferences.edit().putString(service.preferenceKey, value).apply()

}